/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dao;

import hibernate.connection_factory.HibernateUtil;
import org.hibernate.Session;
import org.hibernate.Transaction;

/**
 *
 * @author eleven
 */
public abstract class ElementDAOImpl<T> implements DAO<T> {

    @Override
    public void saveElement(T element) {
        Session session = HibernateUtil.getOrInitSession();
        Transaction transaction = session.beginTransaction();
        session.save(element);
        transaction.commit();
        session.close();
    }
}
